import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ProtocolByteVO, ProtocolByteForm, ProtocolByteQuery } from '@/api/icpms/protocolByte/types';

/**
 * 查询设备协议字节列表
 * @param query
 * @returns {*}
 */

export const listProtocolByte = (query?: ProtocolByteQuery): AxiosPromise<ProtocolByteVO[]> => {
  return request({
    url: '/icpms/protocolByte/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询设备协议字节详细
 * @param id
 */
export const getProtocolByte = (id: string | number): AxiosPromise<ProtocolByteVO> => {
  return request({
    url: '/icpms/protocolByte/' + id,
    method: 'get'
  });
};

/**
 * 新增设备协议字节
 * @param data
 */
export const addProtocolByte = (data: ProtocolByteForm) => {
  return request({
    url: '/icpms/protocolByte',
    method: 'post',
    data: data
  });
};

/**
 * 修改设备协议字节
 * @param data
 */
export const updateProtocolByte = (data: ProtocolByteForm) => {
  return request({
    url: '/icpms/protocolByte',
    method: 'put',
    data: data
  });
};

/**
 * 删除设备协议字节
 * @param id
 */
export const delProtocolByte = (id: string | number | Array<string | number>) => {
  return request({
    url: '/icpms/protocolByte/' + id,
    method: 'delete'
  });
};
